/*	=======================================================================	*/
/// <remarks>
/// Version:
///		- number:	1.0.0
///		- build:	20070417
///		- status:	live
/// </remarks>
/*	=======================================================================	*/
/// <remarks>
/// Global Variables
/// </remarks>
	try {
		var x_form = new ClassSiteForm(x_debug);
		var x_valid = new ClassSiteValid(x_debug);
	} catch(e) {
		alert("loading error(x_form): "+e.description);	
	}
	
/*	=======================================================================	*/
/// <remarks>
/// Class: ClassSiteForm
/// The ClassSiteForm object class has the following purpose/function:
///	- supplies client-side properties and methods for 'form' objects
/// </remarks>
/*	-----------------------------------------------------------------------	*/
/// <summary>
/// The ClassSiteForm object class is constructed as follows:
///		var thisobj = new ClassSiteForm(dbg);
/// - where:
///		- dbg:	debugging switch
/// </summary>
function ClassSiteForm(dbg) {
	/*	-------------------------------------------	*/
	/// <remarks>Properties: Public</remarks>
	/*	-------------------------------------------	*/
	this.parameter = "";
	/*	-------------------------------------------	*/
	/// <remarks>Properties: Private</remarks>
	/*	-------------------------------------------	*/
	var _self = this;	// self allows for a method/property to be called internally
	var _debug = (dbg)? dbg : false;
	var _id = "ClassSiteForm";
	var _frm;
	/*	-------------------------------------------	*/
	/// <remarks>Region: Accessor methods</remarks>
	/*	-------------------------------------------	*/
	this.GetForm = function() { return(_frm); }
	/*	-------------------------------------------	*/
	/// <remarks>Region: Public methods</remarks>
	/*	-------------------------------------------	*/
	this.KeyPress = _KeyPress;
	this.Check = _Check;
	this.Validate = _Validate;
	this.Submit = _Submit;
	this.Previous = _Previous;
	this.ShowHint = _ShowHint;
	this.Clear = _Clear;
	this.SetEmailConfirm = _SetEmailConfirm;
	this.CalcDate = _CalcDate;
	this.SelectCheck = _SelectCheck;
	this.SetDrop = _SetDrop;
	this.ShowBox = _ShowBox;
	this.SetCheck = _SetCheck;
	this.UpdateValue = _UpdateValue;
	this.Compare = _Compare;
	this.SubmitOnce = _SubmitOnce;
	this.EnableButton = _EnableButton;
	this.SetRadio = _SetRadio;
	this.SetValue = _SetValue;
	this.SetVisibility = _SetVisibility;
	this.SetHidden = _SetHidden;
	this.SetVisibile = _SetVisibile;
	this.SetHiddenSubmit = _SetHiddenSubmit;
	this.SetSmsRemain = _SetSmsRemain;
	/// <summary>Method:_SetHiddenSubmit</summary>
	function _SetHiddenSubmit(frm, fl, vl){//form obj field id value 
		_Debug("_Set:", "fm", frm, "fl", fl, "vl", vl);
		if (typeof(frm)=="string") {
			_frm = _getFormByName(frm);
		} else{//assume frm is object of type form 
			_frm = frm;	
			frm = _frm.name;
		}
		var fld = document.getElementById(fl);
		if (fld)
			fld.value = vl;
		_frm.submit();
	}
	/// <summary>Method:_KeyPress</summary>
	function _KeyPress(frm) {
		var ky;
		if (window.event) {
			ky = window.event.keyCode;
			if (window.event.srcElement.type == "textarea")
				return true;
		} else if (!frm.name)
			return false;
		else 
			return true;
			
		if (ky == 13) {
			switch(frm.name) {
			    case "loginForm":			_Check(frm, "inline", validateLogin);	break;
				case "logon_form":			_Check(frm, "login");		break;
				case "contact_form":		_Check(frm, "contact");		break;
				case "feedback_form":		_Check(frm, "feedback");	break;
				case "poll_form":			_Check(frm, "poll");		break;
				default:					_Check(frm, "default", validateForm);	break;
			}
		}
		return true 
	}
	/// <summary>Method:_Check</summary>
	function _Check(frm, typ, func) {
		_Debug("_Check", "frm", frm);				
		if (typeof(frm) == "string") {
			_frm = _getFormByName(frm);
		} else {//assume frm is object of type form 
			_frm = frm;	
			frm = _frm.name;
		}
		_Debug("_Check", "name", _frm.name, " type", typ, " function", typeof(func));
		switch (typ) {
			case "login":		if (_ValidateLogin())		{_SubmitOnce(frm); _frm.submit(); }	break;
			case "email":		if (_ValidateEmail())		_SendEmail();	break;
			case "faqs":		if (_ValidateFaqs())		_frm.submit();	break;
			case "contact":		if (_ValidateContact())		{_SubmitOnce(frm); _frm.submit(); }	break;
			case "feedback":	if (_ValidateFeedback())	{_SubmitOnce(frm); _frm.submit(); }	break;
			case "poll":		if (_ValidatePoll())		{_SubmitOnce(frm); _frm.submit(); }	break;
			case "vfaxaction":	if (_ValidateVFax())		{_SubmitOnce(frm); _frm.submit(); }	break;
			case "select":		_frm.submit();	break;
			case "back":		_Previous();	break;
			case "clear":		_Clear();		break;
			case "valid":
			default:			if (typeof(func) != "function")
									_frm.submit(); 	// submit if validate function does not exist
								else {
									self.Validate = func;
									_Debug("_Check:before self.Validate");
									if (self.Validate(_frm, self)) {
										_Debug("_Check", "OK", true);
										_frm.submit();
									} else {
										_Debug("_Check", "OK", false);
									}
								}
								break;
		}
	}
	/// <summary>Method:_Submit</summary>
	function _Submit(frm, url, chk, typ, nme, prc, id, param) {
		_Debug("_Submit", frm.name, " url:", url);
		_frm = frm;
		var thisurl = url;
		if (typ) {
			thisurl += "&type=" + typ;
			thisurl += "&name=" + nme;
			thisurl += "&process=" + prc;
		}
		if (id)
			thisurl += "&id=" + id;
		if (param)
			thisurl += "&" + param;
		_frm.action = thisurl;
		if (chk)
			_Check(frm, typ);
		else
			_frm.submit();
	}
	/// <summary>Method:_Validate</summary>
	function _Validate(frm) {
		_Debug("_Validate", "frm", frm.name);
	}
	/// <summary>Method:_ValidateFeedback</summary>
	function _ValidateFeedback() {
		return (x_valid.Radio(_frm.Feedback, "Please rate us"));
	}
	/// <summary>Method:_ValidatePoll</summary>
	function _ValidatePoll() {
		_Debug("_ValidatePoll", "_frm", typeof(_frm));
		return (x_valid.Radio(_frm.x_radio_btn, "Please choose a poll option"));
	}
	/// <summary>Method:_ValidateVFax</summary>
	function _ValidateVFax() {
		_Debug("_ValidateVFax", "_frm", typeof(_frm));
		return (x_valid.Drop(_frm.VirtualFaxAction, "Please choose an action"));
	}
	/// <summary>Method:_ValidateLogin</summary>
	function _ValidateLogin(){
		_Debug("_ValidateLogin");
		if (!x_valid.Text(_frm.Username, "Please enter your username"))
			return false;
		if (!x_valid.Text(_frm.Pin, "Please enter your password"))
			return false;
		return true;
	}
	/// <summary>Method:_ValidateEmail</summary>
	function _ValidateEmail(){
		if (!x_valid.Email(_frm.Email_Addr_To, "Please enter the recipients email address"))
			return false;
		if (!x_valid.Text(_frm.Email_From, "Please enter your name or email address"))
			return false;
		if (!x_valid.Text(_frm.Email_Subject, "Please enter the subject of the email"))
			return false;
		return true;
	}
	/// <summary>Method:_ValidateFaqs</summary>
	function _ValidateFaqs(){
		if (!x_valid.Text(_frm.Name, "Please enter your name"))
			return false;
		if (!x_valid.Email(_frm.Email, "Please enter your email address"))
			return false;
		if (!x_valid.Text(_frm.Cell_No, "Please enter your contact number"))
			return false;
		return true;
	}
	/// <summary>Method:_ValidateContact</summary>
	function _ValidateContact(){
		if (!x_valid.Text(_frm.Name, "Please enter your name"))
			return false;
		if (!x_valid.Email(_frm.Email, "Please enter your email address"))
			return false;
		if (!x_valid.Text(_frm.Cell_No, "Please enter your contact number"))
			return false;
		return true;
	}
	/// <summary>Method:_SendEmail</summary>
	function _SendEmail() {
		var act = "nm_email.asp" + document.location.search;
		act = act.replace("siteid=ver5_email", "siteid=ver5_print");
		_frm.action = act;
		_frm.submit();
	}
	/// <summary>Method:_Previous</summary>
	function _Previous() {
		window.history.back();
	}
	/// <summary>Method:_ShowHint</summary>
	function _ShowHint(hintelem, hinttext) {
		var thishint = document.getElementById(hintelem);
		if (thishint)
			thishint.innerHTML = hinttext;
	}
	/// <summary>Method:_Previous</summary>
	function _Clear(frm) {
		if (frm)
			_frm = frm;
		_frm.reset();
	}
	/// <summary>Method:_SetEmailConfirm</summary>
	function _SetEmailConfirm(fldnme, thischk) {
		var thisfld = document.getElementById(fldnme);
		if (thischk.checked == true) {
			thisfld.disabled = false;
			thisfld.focus();
		} else
			thisfld.disabled = true;
	}
	/// <summary>Method:_CalcDate</summary>
	function _CalcDate(fldid) {
		thisid = fldid.id;
		var thisdd = document.getElementById(thisid + "_day");
		var thismm = document.getElementById(thisid + "_month");
		var thisyy = document.getElementById(thisid + "_year");
		
		var dd = (thisdd.value == "Date")? "" : thisdd.value;
		var mm = (thismm.value == "Month")? "" : thismm.value;
		var yy = (thisyy.value == "Year")? "" : thisyy.value;
		
		fldid.value = yy + "-" + mm + "-" + dd;
		_Debug("_CalcDate", "fldid", fldid.value);
	}
	/// <summary>Method:_SelectCheck</summary>
	function _SelectCheck(thisfld, ischeckbox) {
		if (ischeckbox == true) {
			if (thisfld.checked == false) {
				var re = /_check/i;	//	regular expression pattern.
				var fldname = thisfld.name;
				var thisdrop = document.getElementById(fldname.substr(0, fldname.search(re)));
				thisdrop.value = 0;
			}
		} else {
			var thischeck = document.getElementById(thisfld.id + "_check");
			thischeck.checked = (thisfld.value == 0)? false : true;
		}
	}
	/// <summary>Method:_SetDrop</summary>
	function _SetDrop(val, sel, i_arr, s_ord, s_arr, t_ord, t_arr) {
		_Debug("_SetDrop", "val", val, "t_ord", t_ord);
		var i, t_val, t, cnt;
		for (i=0; i<s_arr.length; i++) {
			if(s_arr[i][1] == val) {
				t_val = s_arr[i][0];
				break;
			}
		}
		for (i=0, cnt=1; i<i_arr.length; i++) {
			if(i_arr[i][s_ord] == t_val) {
				t = setTarget(i_arr[i][t_ord]);
				if (t) {
					sel.options[cnt] = t;
					cnt++;
				}
			}
		}
		sel.options.length = cnt;
		function setTarget(val) {
			for(var i=0; i<t_arr.length; i++) {
				if(t_arr[i][0] == val) {
					//_Debug("setTarget", "2", t_arr[i][2], "1", t_arr[i][1]);
					return (new Option(t_arr[i][2], t_arr[i][1]))
				}
			}
			return(null);
		}
	}
	/// <summary>Method:_ShowBox</summary>
	function _ShowBox(obj, thisid, thisval) {
		var root = (document.all)? document.all : document;
		var val = (thisval)? obj.value : obj.selectedIndex;
		if (!thisval && val <= 4) {
			root[thisid][0].style.display = 'block';
		} else if (thisval && val == thisval) {
			root[thisid][0].style.display = 'block';
		} else {
			root[thisid][0].style.display = 'none';
		}
	}
	/// <summary>Method:_SetCheck</summary>
	function _SetCheck(chkName, wantval) {
		var ck = "", ckFld, ckEl, ckEls = document.getElementsByName(chkName);
		for (var i=0; i<ckEls.length; i++) {
			ckEl = ckEls.item(i);
			if (ckEl.type == "hidden")
				ckFld = ckEl;
			else {
				if (wantval)
					ck += (ckEl.checked)? ckEl.value + " " : "-";
				else
					ck += (ckEl.checked)? "yes" : "no";
				if (i!=ckEls.length-1)
					ck+= (wantval)? "" : "|";
			}
		}
		//_Debug("setCheck", "ck", ck);
		if (ckFld)
			ckFld.value = ck;
	}
	/// <summary>Method:_UpdateValue</summary>
	function _UpdateValue(chkObj, chkName, chkValue) {
		var val = chkName.value.substr(1) * 1;
		val = (chkObj.checked) ? val + chkValue * 1 + .0001 : val - chkValue * 1 + .0001;
		var str = "R" + val.toString();
		var i = str.indexOf(".");
		chkName.value = str.substr(0, i + 3);
	}
	/// <summary>Method:_Compare</summary>
	function _Compare(frmName, fldNames, minsel, maxsel) {
		var frm = _getFormByName(frmName);
		var fld = frm.elements[fldNames];
		var cnt = 0;
		for (i=0;i<fld.length;i++) {
			if (fld[i].checked) cnt++;
		}
		if (cnt<minsel) {
			alert("Please select at least " + minsel + " items to compare");
		} else if (cnt>maxsel) {
			alert("Please select up to " + maxsel + " items to compare");
		} else {
			frm.submit();
		}
	}	

	/// <summary>Method:_SubmitOnce - disable the submit button after validation.</summary>
	function _SubmitOnce(frmName) {
		var frm = _getFormByName(frmName);
		for (var i=0; i<frm.length; i++) {
			var obj = frm.elements[i];
			if(obj.type.toLowerCase()=="button") {
				obj.disabled = true;
				if (obj.style.cursor)	// need this test because of problems with IE5.x
					obj.style.cursor = "not-allowed";
				var found = true;
			}
		}
		if (found)
			window.setTimeout("x_form.EnableButton(x_form.GetForm());", 10000); // need to send global variable x_form.GetForm due to settimeout context
		return false;
	}
	
	/// <summary>Method: _EnableButton - re-enables the submit button after a period of time.</summary>
	function _EnableButton(frm) {
		for (var i=0; i<frm.length; i++) {
			var obj = frm.elements[i];
			if(obj.type.toLowerCase()=="button") {
				obj.disabled = false;
				obj.style.cursor = "default";
			}
		}
	}
	/// <summary>Method: _SetRadio</summary>
	function _SetRadio(id, val) { 
		var fl = document.getElementById(id);
		if (fl)
			fl.value = val;
	}
	/// <summary>Method: _SetValue</summary>
	function _SetValue(fld, val) { 
		_Debug("_SetValue", "fld", fld, "val", val);
		var fl = document.getElementById(fld);
		if (fl) {
			fl.value = val;
			_Debug("_SetValue", "value", fl.value);
		}
	}
	/// <summary>Method: _SetVisibility</summary>
	function _SetVisibility(vis, elt, fld, nos) { 
		_Debug("_SetVisibility", "vis", vis, "fld", fld, "elt", elt);
		if (vis)
			_SetVisibile(elt, nos);
		else
			_SetHidden(elt, nos);
		var fl = document.getElementById(fld);
		if (fl) {
			fl.value = (fl && !vis)? "n/a" : "";
			_Debug("_SetVisibility", "value", fl.value);
		}
	}
	/// <summary>Method: _SetHidden - .</summary>
	function _SetHidden(elt, nospace) { 
		_Debug("_SetHidden", "elt", elt, "nospace", nospace);
		var el = document.getElementById(elt);
		if (el) {
			(nospace)? el.style.display = 'none' : el.style.visibility = "hidden";
		}
	}
	/// <summary>Method: _SetVisibile - .</summary>
	function _SetVisibile(elt, nospace) { 
		_Debug("_SetVisibile", "elt", elt, "nospace", nospace);
		var el = document.getElementById(elt);
		if (el) {
			_Debug("_SetVisibile", "display", (el.style.display), "nospace", nospace);
			(nospace)? el.style.display = 'block' : el.style.visibility = "visible";
		}
	}
	/// <summary>Method: _getFormByName - retrieves the form object based on a reference passed.
	function _getFormByName(frmName) {
		var frm = document.getElementById(frmName);
		if (!frm)	// used if the form has a name instead of id
			frm = document.forms[frmName];
		return frm;
	}
	/// <summary>Method:_SetSmsRemain</summary>
	function _SetSmsRemain(thistxt, thishint) {
		var thiscnt = document.getElementById(thistxt.id + "_count");
		var thismsg = thistxt.value;
		var thislen = thismsg.length;
		if (thislen > 160)
			alert(thishint);
		else
			thiscnt.value = 160 - thislen;
	}
	
	/// <summary>Method:_Debug - write debugging message. First param is the method label, followed by name, value pairs</summary>
	function _Debug(arg) {
		if (_debug) {
			s = "<!-- ClassSiteForm::"
			s = s.concat(arguments[0], ":");
			var argn = arguments.length;
			for(var i=1; i<argn; i=i+2)
				s = s.concat(arguments[i], ":", arguments[i+1], " ");
			alert(s.concat("-->\n"));
		}
	}
}
/*	=======================================================================	*/
/// <remarks>
/// Class: ClassSiteValid
/// The ClassSiteValid object class has the following purpose/function:
///	- supplies client-side properties and methods for 'form' objects
/// </remarks>
/*	-----------------------------------------------------------------------	*/
/// <summary>
/// The ClassSiteValid object class is constructed as follows:
///		var thisobj = new ClassSiteValid(dbg);
/// - where:
///		- dbg:	debugging switch
/// </summary>
function ClassSiteValid(dbg) {
	/*	-------------------------------------------	*/
	/// <remarks>Properties: Private</remarks>
	/*	-------------------------------------------	*/
	var _self = this;	// self allows for a method/property to be called internally
	var _debug = (dbg)? dbg : false;
	var _iBurstSuffix = ["@somesite.com", "@wbs.co.za", "eject.co.za", "euroburst.co.za", "fusionreactor.co.za", "somesite.com", "iburst.lantic.net", "iburstgroup.co.za", "nashuabb.co.za", "siyathetha.net", "storm.co.za", "tradepage.co.za", "uiplay.com", "zaiburst.net"];

	/*	-------------------------------------------	*/
	/// <remarks>Region: Public methods</remarks>
	/*	-------------------------------------------	*/
	this.Text = _Text;
	this.Date = _Date;
	this.Password = _Password;
	this.Email = _Email;
	this.EmailiBurst = _EmailiBurst;
	this.Check = _Check;
	this.Radio = _Radio;
	this.Drop = _Drop;
	this.Number = _Number;
	this.StripCell = _StripCell;
	this.Cell = _Cell;
	this.IntCell = _IntCell;
	this.DateRange = _DateRange;
	this.PostalCode = _PostalCode;
	this.ID = _ID;
	this.TextDrop = _TextDrop;
	this.NumDrop = _NumDrop;
	this.iBurstUTID = _iBurstUTID;
	this.Checks = _Checks;
	this.Expiry = _Expiry;
	this.Debug = _Debug;
	
	/// <summary>Method:_Text</summary>
	function _Text(thisfld, thishint) {
		_Debug("_Text", "thishint", thishint, "thisfld", thisfld.name);
		
		if (!thisfld.value)// || thisfld.value.length <= 0)
			return _Notify(thishint, thisfld, true);
		return true;
	}
	/// <summary>Method:_Date</summary>
	function _Date(thisfld, thishint) {
		_Debug("_Date", "thisfld", thisfld.name);
		if (!thisfld.value)
			return _Notify(thishint, thisfld, false);
		return true;
	}
	/// <summary>Method:_Password</summary>
	function _Password(thisfld, confirmfld, thishint) {
		_Debug("_Password", "thisfld", thisfld.name);
		if (thisfld.value.length < 6)	//at least 6
			return _Notify(thishint, thisfld, true);
		// check if both password fields are the same
		/*
		if (thisfld.value != confirmfld.value) {
			return _Notify("The two passwords are not the same.", thisfld, true);
		}*/
		return (true);
	}
	/// <summary>Method:_Email</summary>
	function _Email(thisfld, thishint){
		_Debug("_Email", "thisfld", thisfld.name);
		validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
		strEmail = thisfld.value;
		if (strEmail) {
			// search email text for regular exp matches
			if (strEmail.search(validRegExp) == -1)
				return _Notify(thishint, thisfld, true);
			return true; 
		}
		else alert(thishint);
	}
	/// <summary>Method:_EmailiBurst</summary>
	function _EmailiBurst(thisfld, thishint){
		_Debug("_EmailiBurst", "thisfld", thisfld.name);
		strEmail = thisfld.value;
		if (strEmail) {
			var ndx, len;
			for (var i=0;i<_iBurstSuffix.length;i++) {
				_Debug(strEmail + "<-?->" + _iBurstSuffix[i])
				len = _iBurstSuffix[i].length;
				ndx = strEmail.indexOf(_iBurstSuffix[i]);
				if (ndx > 0 && strEmail.length > len)
					return true;
			}
			return _Notify(thishint, thisfld, true);
		}
		else alert(thishint);
	}
	/// <summary>Method:_Check</summary>
	function _Check(thisfld, thishint) {
		_Debug("_Check", "thisfld", thisfld.name);
		if (!thisfld.checked)
			return _Notify(thishint, thisfld, true);
		return true;
	}
	/// <summary>Method:_Radio</summary>
	function _Radio(thisfld, thishint) {
		_Debug("_Radio", "thisfld", thisfld);
		var bChecked = false;
		for (i=0;i<thisfld.length;i++) {
			if (thisfld[i].checked)
			   return true;
		}
		alert(thishint);
		window.navigate("#" + thisfld.id);
		return false;
	}
	/// <summary>Method:_Drop</summary>
	function _Drop(thisfld, thishint) {
		_Debug("_Drop", "thisfld", (thisfld)? thisfld.name : "select not defined");
		if (thisfld.selectedIndex==0)
			return _Notify(thishint, thisfld, true);
		return true;
	}
	
	/// <summary>Method:_TextDrop</summary>
	function _TextDrop(thisfld, thishint) {
		var thisdrop = document.getElementById(thisfld.id + "_drop");
		if (_Text(thisfld, thishint) && _Drop(thisdrop, thishint))
			return true;
		else
			return false;
	}
	
	/// <summary>Method:_NumDrop</summary>
	function _NumDrop(thisfld, thishint) {
		_Debug("_NumDrop", "thishint", thishint, "thisfld", thisfld.name);
		if(_TextDrop(thisfld, thishint) && _Number(thisfld, thishint))
			return true;
		else
			return false;
	}
	/// <summary>Method:_Number</summary>
	function _Number(thisfld, thishint, checkfld, checktype) {
		_Debug("_Number", "thisfld", thisfld.name);
		var validRegExp = /(^-*\d+$)|(^-*\d+\.\d+$)/i;///^[0-9]{1,}.{0,}[0-9]{0,}$/i;
		var strVal = thisfld.value;
		var isvalid = true;
		if (strVal) {
			//var arrMatch = strVal.match(validRegExp);
			//_Debug("_Number", "arrMatch", arrMatch.length);
			if (strVal.search(validRegExp) == -1)// || strVal.split(validRegExp).length > 1) 
				isvalid = false;
			else if (checkfld) {
				var thisval = parseFloat(strVal);
				var chckval = parseFloat(checkfld.value);
				if (isNaN(thisval) || isNaN(thisval)) 
					isvalid = false;
				else {
					// use checktype (later..)
					if (thisval < chckval)
						isvalid = false;
				}
			}
		}
		else 
			isvalid = false;
		
		if (isvalid)
			return true;
		else
			return _Notify(thishint, thisfld, true);
	}
	/// <summary>Method:_StripCell - strips characters, then calls _Cell validation</summary>
	function _StripCell(thisfld, thishint){
		var stripexp = /[()\- ]/g;
		thisfld.value = thisfld.value.replace(stripexp, "");
		return _Cell(thisfld, thishint);
	}
	/// <summary>Method:_Cell</summary>
	/*	==========================================	
		Check for a valid cell number: 				
		-	Check 1: They begin "0[7/8/9][2/3/4]";	
		-	Check 2: only 0-9						
		-	Check 3: must be 10 digits				
		========================================	*/
	function _Cell(thisfld, thishint) {
		_Debug("_Cell", "thisfld", thisfld.name);
		var retval = (thisfld.value)? 0 : 1;
		//alert(retval + ", " +  thisfld.value);
		if (!retval) {
			var val = thisfld.value;
			var cellexp = /[0-9]{10}/;		// NB this will accept more than 10 digits!
			var strtexp = /0[789][23468]/ ;
			if (cellexp.test(val) && val.length==10) {
				retval = (strtexp.test(val)) ? 0 : 1;
				if (retval)
					thishint = thishint.concat(" (must start 07, 08 or 09)");
			} else {
				thishint = thishint.concat(" (must be 10 digits)");
				retval = 1;
			}
		}
		if (retval)
			return _Notify(thishint, thisfld, false);
		else
			return true;
	}
	/// <summary>Method:_IntCell</summary>
	function _IntCell(thisfld, thishint){
		_Debug("_IntCell", "thisfld", thisfld.name);
		var retval = (thisfld.value)? 0 : 1;
		if (!retval) {
			var val = thisfld.value;
			var cellexp = /\d{11}/;		// NB this will accept more than 10 digits!
			var strtexp = /27[789][23468]/ ;
			if (cellexp.test(val) && val.length==11)
				retval = (strtexp.test(val)) ? 0 : 1;
			else
				retval = 1;
			}
		if (retval)
			return _Notify(thishint, thisfld, true);
		else
			return true;
	}
	/// <summary>Method:_DateRange</summary>
	function _DateRange(thisfld, thishint){
		_Debug("_DateRange", "thisfld", thisfld.length);
		if (_Radio(thisfld, thishint)) {
			var thischk = "";
			var thisid = "";
			for (i=0;i<thisfld.length;i++) {
				if (thisfld[i].checked) {
				   thischk = thisfld[i].value;
				   thisid = thisfld[i].id;
				   break;
			   }
			}
			if (thischk == "Date") {
				var thisdate = document.getElementById(thisid + "_date");
				if (_Drop(thisdate, thishint)) {
					var thismnth = document.getElementById(thisid + "_month");
					return(_Drop(thismnth, thishint));
				}
				else
					return false;
			}
			return true;
		}
		else
			return false;
	}
	/// <summary>Method:_PostalCode</summary>
	function _PostalCode(thisfld, thishint) {
		_Debug("_PostalCode", "thisfld", thisfld.name);
		var validRegExp = /[0-9]{4,4}/;
		var strVal = thisfld.value;
		var isvalid = true;
		if (strVal && validRegExp.test(strVal) && strVal.length==4)
			isvalid = true;
		else 
			isvalid = false;
		
		if (isvalid)
			return true;
		else
			return _Notify(thishint, thisfld, true);
	}
	/// <summary>Method:_ID</summary>
	function _ID(thisfld, thishint) {
		var stripexp = /[()\- ]/g;
		thisfld.value = thisfld.value.replace(stripexp, "");
		return _validID(thisfld, thishint);
	}
	/// <summary>Method:_validID</summary>
	function _validID(thisfld, thishint) {
		_Debug("_ID", "thisfld", thisfld.name);
		var validRegExp = /[0-9]{13,13}/;
		var strVal = thisfld.value;
		var isvalid = true;
		if (strVal) {
			if (strVal.search(validRegExp) == -1)
				isvalid = false;
			else
				isvalid = (strVal.length == 13);
		}
		else 
			isvalid = false;
		
		if (isvalid)
			return true;
		else
			return _Notify(thishint, thisfld, true);
	}
	/// <summary>Method:_iBurstUTID</summary>
	function _iBurstUTID(thisfld, thishint) {
		_Debug("_iBurstUTID", "thisfld", thisfld.name);
		var validRegExp = /[0-9]{15,15}/;
		var strVal = thisfld.value;
		var isvalid = true;
		if (strVal && validRegExp.test(strVal) && strVal.length==15)
			isvalid = true;
		else 
			isvalid = false;
		
		if (isvalid)
			return true;
		else
			return _Notify(thishint, thisfld, true);
	}
	/// <summary>Method:_Checks</summary>
	function _Checks(thisfld, thishint) {
		_Debug("_Checks", "thisfld", thisfld.length);
		var fld;
		for (var i=0; i<thisfld.length; i++) {
			fld = thisfld.item(i);
			if (fld.checked)
				return true;
		}
		return _Notify(thishint, thisfld, false);
	}
	/// <summary>Method:_Expiry</summary>
	function _Expiry(thisfld, thishint) {
		_Debug("_Expiry", "thisfld", thisfld.name);
		var validRegExp = /[0-9]{6,6}/;
		var strVal = thisfld.value;
		var isvalid = true;
		if (strVal && validRegExp.test(strVal) && strVal.length==6)
			isvalid = true;
		else 
			isvalid = false;
		
		return (isvalid)? true : _Notify(thishint, thisfld, true);
	}
	/// <summary>Method:_Notify - show validation message, select, set focus.</summary>
	function _Notify(hnt, fld, sel) {
		alert(hnt);
		sel = (typeof(sel)!="undefined")? sel : true;
		if (sel && fld.style.visibility == "visible") {
			fld.select();
			fld.focus();
		}
		return false;
	}
	
	/// <summary>Method:_Debug - write debugging message.</summary>
	function _Debug(arg) {
		if (_debug) {
			s = "<!-- ClassSiteValid::"
			s = s.concat(arguments[0], ":");
			var argn = arguments.length;
			for(var i=1; i<argn; i=i+2)
				s = s.concat(arguments[i], ":", arguments[i+1], " ");
			alert(s.concat("-->\n"));
		}
	}
}